/*    */ package btsm.bean;
/*    */ 
/*    */ import java.io.PrintStream;
/*    */ import java.sql.Connection;
/*    */ import java.sql.DriverManager;
/*    */ import java.sql.ResultSet;
/*    */ import java.sql.SQLException;
/*    */ import java.sql.Statement;
/*    */ 
/*    */ public class dbConnector
/*    */ {
/* 13 */   private Connection con = null;
/* 14 */   private Statement stmt = null;
/* 15 */   ResultSet rs = null;
/*    */ 
/*    */   private void dbcoInit() throws Exception
/*    */   {
/*    */     try {
/* 20 */       Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
/* 21 */       this.con = DriverManager.getConnection("proxool.dbpool");
/* 22 */       this.stmt = this.con.createStatement(1005, 1008);
/*    */     } catch (SQLException ex) {
/* 24 */       System.err.println("init fail: " + ex.getMessage());
/*    */     }
/*    */   }
/*    */ 
/*    */   public ResultSet execQuery(String sql) throws Exception
/*    */   {
/*    */     try {
/* 31 */       if (this.con == null) {
/* 32 */         dbcoInit();
/*    */       }
/* 34 */       return this.rs = this.stmt.executeQuery(sql);
/*    */     } catch (SQLException e) {
/* 36 */       throw e;
/*    */     }
/*    */   }
/*    */ 
/*    */   public int execUpdate(String sql) throws Exception
/*    */   {
/* 42 */     int iRet = -1;
/*    */     try {
/* 44 */       if (this.con == null) {
/* 45 */         dbcoInit();
/*    */       }
/* 47 */       iRet = this.stmt.executeUpdate(sql);
/*    */     } catch (SQLException ex) {
/* 49 */       ex.printStackTrace();
/* 50 */       System.err.println("sql error: " + ex.getMessage());
/*    */     }
/* 52 */     return iRet;
/*    */   }
/*    */ 
/*    */   public void trgEnable()
/*    */   {
/*    */     try {
/* 58 */       execUpdate("SET @DISABLE_GEOINSERT_TRIGER = 0;");
/*    */     } catch (Exception e) {
/* 60 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public void trgDisable() {
/*    */     try {
/* 66 */       execUpdate("SET @DISABLE_GEOINSERT_TRIGER = 1;");
/*    */     } catch (Exception e) {
/* 68 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public void closeAll()
/*    */   {
/*    */     try {
/* 75 */       if (this.rs != null) {
/* 76 */         this.rs.close();
/*    */       }
/* 78 */       this.rs = null;
/*    */ 
/* 80 */       if (this.stmt != null) {
/* 81 */         this.stmt.close();
/*    */       }
/* 83 */       this.stmt = null;
/* 84 */       if (this.con != null) {
/* 85 */         this.con.close();
/*    */       }
/* 87 */       this.con = null;
/*    */     } catch (SQLException e) {
/* 89 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.bean.dbConnector
 * JD-Core Version:    0.6.2
 */